/**
 * 部门添加js
 */
var comValidform = null;
var returnStatus = false;
var bespeakUpdate = {
	dataCache : null,
	bespeakOrder : null,
	key : null, 
	startEvent : function() {

		comValidform = $(".com-addForm").Validform({
			tiptype : 2,
			tipSweep : true,
			beforeSubmit : function(curform) {

				localStorage.removeItem(bespeakUpdate.key);
				var url = 'mgr/reservation/update';
				var params = jsUtils.serializeJson($('.com-addForm'));
				var cb = function(data) {
					alert(data.msg);
					// 成功返回
					if (data.resultCode == 200) {
						// 关闭窗口并刷新数据
						art.dialog.close();
						returnStatus = true;
					}
				};
				sendApiNoLoadSync(url, params, cb, 'POST');
				return false;
			}
		});
	},

	init : function() {

		var id = art.dialog.data('id');
		
		bespeakUpdate.key = id + "_Bespeak_Key";
		bespeakOrder = eval('(' + localStorage.getItem(bespeakUpdate.key) + ')');
		
		$("input[name='bespeakId']").val(bespeakOrder.col01id);
		$("input[name='id']").val(bespeakOrder.col01id);
		$("input[name='productName']").val(bespeakOrder.col12productName);
		$("input[name='amount']").val(bespeakOrder.col02amount);
		$("input[name='payAmount']").val(bespeakOrder.col03payAmount);
		$("input[name='insiderPhone']").val(bespeakOrder.col18insidePhoneNum);
		$("input[name='operator']").val(userId);
		$("input[name='productId']").val(bespeakOrder.col10productId);

	}
}
$(document).ready(function() {
	bespeakUpdate.init();
	bespeakUpdate.startEvent();
});
function submitForm() {
	comValidform.submitForm();
	return returnStatus;
}